package com.panda.pojo;


import com.panda.utils.StringUtils;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Map;
import java.util.Set;


/*

    组件是特殊的标签元素

    区别在于:

        组件的体中只接受映射列表,并且解析时期在panda解析之前完成

        组件有需要文件依赖


 */

@Setter
@Getter
public class Component extends Element{

    private static final long serialVersionUID = 1L;

    //可被映射的域变量
    private Set<String> canMappingScopeParams;

    //本地保护字符串
    private Map<String, String> localStringMap;

    public Component(Context context, String name) {
        super(context, name);
        setRepetitive(true);
    }

    private Set<String> js;

    private Set<String> css;

    //使用这个名称
    private String componentName;

    @Override
    public void handleDep() {

        if (js != null) {
            context.getJs().addAll(js);
        }

        if (css != null) {
            context.getCss().addAll(css);
        }

        super.handleDep();
    }


    @Override
    public String toString() {
        return StringUtils.fillBack(localStringMap, super.toString());
    }

}
